package com.hxzy.service.shengpi.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzy.entity.shengpi.ShengpiCategory;
import com.hxzy.mapper.shengpi.ShengpiCategoryMapper;
import com.hxzy.service.shengpi.ShengpiCategoryService;
import org.springframework.stereotype.Service;

/**
 * 审批分类
 * @author Administrator
 */
@Service
public class ShengpiCategoryServiceImpl extends ServiceImpl<ShengpiCategoryMapper, ShengpiCategory> implements ShengpiCategoryService {

    @Override
    public boolean add(ShengpiCategory shengpiCategory) {
        //得到数据库中最大的值
        String id=this.getBaseMapper().selectMaxId();
        if(id.equals("0")){
            id="A10001";
        }else{
            int num=Integer.parseInt(id.substring(1))+1;
            id="A"+num;
        }

        shengpiCategory.setId(id);
        boolean save = this.save(shengpiCategory);

        return save;
    }
}
